<?php

declare (strict_types=1);
namespace App\Model;

use Hyperf\Database\Model\Events\Created;

/**
 * @property int $id 
 * @property string $spec_name 参数key
 * @property int $product_id 商品id
 */
class ProductSpecKey extends Model
{
    public $timestamps  = false;
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'fly_product_spec_key';
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */

    protected $fillable = ['id','product_id','spec_name'];
    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = ['id' => 'integer', 'product_id' => 'integer','spec_name'=>'string'];

    public function values()
    {
        return $this->hasMany(ProductSpecValue::class, 'spec_key', 'id')
            ->select();
    }
}